# $Id$
# Maintainer (ArchLinux): Alexander Rødseth <rodseth@gmail.com>
# Contributor (ArchLinux): William Rea <sillywilly@gmail.com>
# Contributor (ArchLinux): Stefan Husmann <stefan-husmann@t-online.de>
# Maintainer (MSYS2): Ray Donnelly <mingw.android@gmail.com>

_realname=arpack
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=3.7.0
pkgrel=2
arch=('any')
pkgdesc="Fortran77 subroutines designed to solve large scale eigenvalue problems (mingw-w64)"
url='https://forge.scilab.org/index.php/p/arpack-ng/'
license=('BSD')
depends=("${MINGW_PACKAGE_PREFIX}-gcc-libgfortran"
         "${MINGW_PACKAGE_PREFIX}-openblas")
makedepends=("${MINGW_PACKAGE_PREFIX}-gcc-fortran")
provides=("${MINGW_PACKAGE_PREFIX}-arpack-ng")
source=(${_realname}-${pkgver}.tar.gz::https://github.com/opencollab/arpack-ng/archive/${pkgver}.tar.gz)
sha256sums=('972e3fc3cd0b9d6b5a737c9bf6fd07515c0d6549319d4ffb06970e64fa3cc2d6')

prepare() {
 cd "${srcdir}/${_realname}-ng-${pkgver}"
 ./bootstrap
}

build() {
  [[ -d "${srcdir}"/build-${CARCH} ]] && rm -rf "${srcdir}"/build-${CARCH}
  mkdir "${srcdir}"/build-${CARCH} && cd "${srcdir}"/build-${CARCH}

  ../${_realname}-ng-${pkgver}/configure \
    --prefix=${MINGW_PREFIX} \
    --build=${MINGW_CHOST} \
    --host=${MINGW_CHOST} \
    --enable-static \
    --enable-shared \
    --with-blas=openblas

  make
}

#check() {
#  cd "${srcdir}"/build-${CARCH}
#  make check
#}

package() {
  cd "${srcdir}"/build-${CARCH}

  make DESTDIR="${pkgdir}"/ install
  install -Dm644 ${srcdir}/${_realname}-ng-${pkgver}/COPYING \
    ${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/COPYING
}
